package com.cci.kangdao.wechatOrder.enums.wx;

/**
 * 微信CGI账号
 */

public enum WxCgi {

    ACCESS_TOKEN("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", "公众号获取access_token"),
    MESSAGE("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s", "公众号推送消息接口"),
    USER_INFO("https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN","获取用户基本信息"),
    JSAPI_TICKET("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi","请求获得jsapi_ticket")
    ;

    private String url;
    private String name;

    WxCgi(String url, String name) {
        this.url = url;
        this.name = name;
    }

    /**
     * 对请示地址进行参数转换
     *
     * @param body
     * @return
     */
    public String convert(String... body) {
        return String.format(this.getUrl(), body);
    }

    public String getUrl() {
        return this.url;
    }

}
